<template>
  <div>
    <el-cascader size="mini" placeholder="全部"
      v-model="value" :options="options"
      :props="{ expandTrigger: 'hover',multiple :true}"
      @change="handleChange">
    </el-cascader>{{value}}
  </div>
</template>

<script>
import { mapState, mapMutations } from 'vuex';
export default {
  name:'crmSelect',
  computed:{
    ...mapState([
      'paramsResetFlag',
      'postParams'
    ]),
  },
  watch:{
    paramsResetFlag:function(nv,ov){//监听复位标识
      this.value.splice(0,this.value.length);//本体数据复位
      // this.updata2Store();//通知$store数据修改
    },
  },
  props:{
    options:{
      type:Array,
      default:function(){
        return [{
          label:'父级',value:0,
          children:[{label:'子级',value:0}]
        }]
      }
    },
  },
  data(){
    return {
      isDev: process.env.NODE_ENV == 'development',
      value:[],
    }
  },
  methods:{
    handleChange:function(value){
      let sp = this.postParams.SPVALUE;
      if(value.includes(sp)){
        this.value.splice(0,this.value.length,sp)
      }
      // this.updata2Store()
    },
    updata2Store:function(){
      // this.$store.commit('postParams/setSelfTag',{
      //   pid:this.parent.pid,
      //   arr:this.$_.cloneDeep(this.value)
      // })
    },
  }
}
</script>

<style lang="less" scoped></style>